package com.sm.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import com.sm.dao.ClsDao;
import com.sm.model.Cls;

@Controller
@RequestMapping("cls")
public class ClsController {

	@Autowired
	private ClsDao clsDao;
	
	/**
	 * 获取班级列表
	 * @return
	 */
	@RequestMapping(value = "/showcls" , method = RequestMethod.GET)
	public ModelAndView getCls(HttpServletRequest request) {
		ModelAndView modelAndView = new ModelAndView("main");
		List<Cls> cls =  clsDao.list();
		
		String mainPage="displayclass.jsp";
		
		request.setAttribute("list", cls);
		request.setAttribute("mainPage", mainPage);
		
		return modelAndView;
	}
}
